﻿// --------------------------------
// <copyright file="ExpressionTest.cs" company="TRONSoft">
//     Copyright (c) TRONSoft.
// </copyright>
// <license>
//   This source code is subject to terms and conditions of the Microsoft
//   Public License. A copy of the license can be found in the License.html
//   file at the root of this distribution. If you cannot locate the
//   Microsoft Public License, please send an email to dlr@microsoft.com.
//   By using this source code in any fashion, you are agreeing to be bound 
//   by the terms of the Microsoft Public License. You must not remove this
//   notice, or any other, from this software.
// </license>
// <author>Tron</author>
// ---------------------------------

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Tronsoft.Actucal.CalculationEngineCreator.Test
{    
    /// <summary>
    ///This is a test class for ExpressionTest and is intended
    ///to contain all ExpressionTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ExpressionTest
    {
        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Value
        ///</summary>
        [TestMethod()]
        [DeploymentItem("CalculationEngineCreator.dll")]
        public void The_Value_Should_The_Assigned_One()
        {
            Formula expr = new Formula("name", "value");
            Assert.AreEqual(expr.Value, "value");
        }

        /// <summary>
        ///A test for Name
        ///</summary>
        [TestMethod()]
        [DeploymentItem("CalculationEngineCreator.dll")]
        public void The_Name_Should_The_Assigned_One()
        {
            Formula expr = new Formula("name", "value");
            Assert.AreEqual(expr.Name, "name");
        }

        /// <summary>
        ///A test for Expression Constructor
        ///</summary>
        [TestMethod()]
        [DeploymentItem("CalculationEngineCreator.dll")]
        [ExpectedException(typeof(ArgumentNullException))]
        public void Constructor_Throw_Exception_Because_Name_Null()
        {
            string name = null; 
            string value = null; 
            Formula target = new Formula(name, value);
        }

        /// <summary>
        ///A test for Expression Constructor
        ///</summary>
        [TestMethod()]
        [DeploymentItem("CalculationEngineCreator.dll")]
        [ExpectedException(typeof(ArgumentNullException))]
        public void Constructor_Throw_Exception_Because_Value_Null()
        {
            string name = "name";
            string value = string.Empty;
            Formula target = new Formula(name, value);
        }
    }
}
